<?php
session_start();
error_reporting(0);
include "./config/connection.php";
if($_SESSION['username']!="")
{
$cari = (isset($_GET['cari'])) ? filter($_GET['cari']) : '';
?>
<!DOCTYPE html>
<html lang="en">
  <head>
       <? include "./include/menuatas.php"; ?>
	    <? include "./include/js.php"; ?>
                   <a href="transfer_add.php">
                   <button class="btn" type="submit" >
                    <i class="icon-plus"> </i> Tambah Bukti Pengiriman
                    </button>
                    </a>   
               </div>
            </div>
            
            <?php
		
		if(!empty($cari)) $syarat = " AND id_buktipengiriman like '%$cari%' OR id_pemesanan like '%$cari%'";
		else $syarat="";
		$query= "SELECT *
				 FROM bukti_pengiriman
				 WHERE 1=1 $syarat ORDER BY id_buktipengiriman DESC";
		//echo $query;
		$jumData = mysql_num_rows(mysql_query($query));	        
	   ?>
			<div class="search"> 
              <form method="GET" action="">
					<fieldset>
						<input class="text" type="text" name="cari" onblur="if(this.value=='')this.value='pencarian pengiriman...';" onclick="if(this.value=='pencarian pengiriman...')this.value='';" name="search" value="pencarian pengiriman..." />
						<input class="submit" type="submit" value="" />
					</fieldset>
				</form>
				</div>
        <?php
			if(!empty($cari)) echo "<p></p><a href='transfer.php'>Kembali Ke Data Pengiriman</a><div style='clear:both'>Ditemukan $jumData data produk dengan kata kunci $cari:</div>";	
		?>
			<table class="table table-striped">							
						<thead>
							<td><b>NO</b></td>
                            <td><b>ID PEMBAYARAN<b></td>
                            <td><b>ID PEMESANAN</b></td>
							<td><b>AKSI</b></td>
						</thead>
			<?php
				$item_per_page=10; 
				$offset=paging($item_per_page); $q=$query." LIMIT $offset, $item_per_page";	
				$r=mysql_query($q) or die("Error: Query GAGAL"); $n=mysql_num_rows($r); $no=1;
				if($n>0){
				while($row=mysql_fetch_array($r)){
			?>
				<tr>
					<td><?php echo ($no+$offset);?></td>
                        <td><?php echo $row[0];?></td>
                        <td><?php echo $row[1];?></td>
						<td>
			
					<a href='transfer_edit.php?id_buktipengiriman=<?php echo $row[0];?>' >Edit</a>&nbsp;&nbsp;
					<a href='transfer_process_delete.php?id_buktipengiriman=<?php echo $row[0];?>' onclick="return confirm('Anda Yakin Akan Menghapus?')" >Hapus</a>
				</td>
            </tr>
		<?php
			$no++;
			}
		}	 
		else{
			if(!empty($cari)) $str="Tidak ada data dengan kata kunci <strong>$cari</strong>";
			else $str="Tidak ada data";
			echo "<tr><td colspan='7' align='center'>$str</td></tr>";
		}
			
			echo "</table>";
			echo_paging($jumData,"transfer.php?cari=$cari&",$item_per_page);
		?>   
          </div>
          </div><!--/row-->
          </div><!--/row-->
        </div><!--/span-->
      </div><!--/row-->
      </div>	
      <hr>
	<? 
		include "./include/menubawah.php"; ?>
    <?php
    ?>
  </body>
</html>
<?php
    }
else {
    include 'warning.php';
}
?>